#pragma once
#include "nnse_support.h"

namespace SimpleGUI
{
	template <class T, class U> public ref class Problem : public System::Windows::Forms::Form
	{
		// Constructor and Destructor
			public: Problem(nnse::problem<T, U>^ p);
			protected: virtual ~Problem();
		// Member Variables
			private: System::ComponentModel::IContainer^  components;
			private: System::Windows::Forms::Label^  file_label;
			private: System::Windows::Forms::TextBox^  file_textBox;
			private: System::Windows::Forms::Button^ load_button;
			private: System::Windows::Forms::ToolTip^ load_toolTip;
			private: System::Windows::Forms::OpenFileDialog^  load_openFileDialog;
			private: System::Windows::Forms::Button^ save_button;
			private: System::Windows::Forms::ToolTip^ save_toolTip;
			private: System::Windows::Forms::SaveFileDialog^  save_saveFileDialog;
			private: System::Windows::Forms::Button^  create_button;
			private: System::Windows::Forms::ToolTip^  create_toolTip;
			private: System::Windows::Forms::Button^ prev_button;
			private: System::Windows::Forms::ToolTip^  prev_toolTip;
			private: System::Windows::Forms::Button^ next_button;
			private: System::Windows::Forms::ToolTip^  next_toolTip;
			private: System::Windows::Forms::Panel^  training_panel;
			private: System::Windows::Forms::RadioButton^ training_radioButton;
			private: System::Windows::Forms::ToolTip^  training_toolTip;
			private: System::Windows::Forms::RadioButton^ testing_radioButton;
			private: System::Windows::Forms::ToolTip^  testing_toolTip;
			private: System::Windows::Forms::Panel^  input_panel;
			private: System::Windows::Forms::RadioButton^  input_radioButton;
			private: System::Windows::Forms::ToolTip^  input_toolTip;
			private: System::Windows::Forms::RadioButton^  target_radioButton;
			private: System::Windows::Forms::ToolTip^  target_toolTip;
			private: System::Windows::Forms::Label^  current_training_example_label;
			private: System::Windows::Forms::TextBox^  current_training_example_textBox;
			private: System::Windows::Forms::Label^  current_testing_example_label;
			private: System::Windows::Forms::TextBox^  current_testing_example_textBox;
			private: System::Windows::Forms::Button^  create_solver_button;
			private: System::Windows::Forms::ToolTip^  create_solver_toolTip;
			private: System::Windows::Forms::Label^  status_label;
			private: System::Windows::Forms::ProgressBar^  status_progressBar;
			private: System::Windows::Forms::TextBox^  comment_textBox;
			private: System::Windows::Forms::ToolTip^  comment_toolTip;
			private: array<System::Windows::Forms::Label^>^ grid;
			private: System::Windows::Forms::ToolTip^  grid_toolTip;
			private: nnse::problem<T, U>^ parent;
		// GUI Functions
			private: System::Void load_button_Click(System::Object^ sender, System::EventArgs^ e);
			private: System::Void save_button_Click(System::Object^ sender, System::EventArgs^ e);
			private: System::Void create_button_Click(System::Object^ sender, System::EventArgs^ e);
			private: System::Void prev_button_Click(System::Object^ sender, System::EventArgs^ e);
			private: System::Void next_button_Click(System::Object^ sender, System::EventArgs^ e);
			private: System::Void training_radioButton_CheckedChanged(System::Object^ sender, System::EventArgs^ e);
			private: System::Void testing_radioButton_CheckedChanged(System::Object^ sender, System::EventArgs^ e);
			private: System::Void input_radioButton_CheckedChanged(System::Object^  sender, System::EventArgs^  e);
			private: System::Void target_radioButton_CheckedChanged(System::Object^  sender, System::EventArgs^  e);
			private: System::Void create_solver_button_Click(System::Object^  sender, System::EventArgs^  e);
			private: System::Void comment_textBox_TextChanged(System::Object^  sender, System::EventArgs^  e);
			private: System::Void grid_Click(System::Object^ sender, System::EventArgs^ e);
			public: System::Void update_form(System::String^ progress_text, unsigned int progress_min, unsigned int progress_val, unsigned int progress_max);
			private: System::Void add_grid();
			private: System::Void remove_grid();
			private: System::Void show_vector();
			private: System::Void set_file_filter();
#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->components = (gcnew System::ComponentModel::Container());
			this->prev_button = (gcnew System::Windows::Forms::Button());
			this->next_button = (gcnew System::Windows::Forms::Button());
			this->training_radioButton = (gcnew System::Windows::Forms::RadioButton());
			this->testing_radioButton = (gcnew System::Windows::Forms::RadioButton());
			this->training_panel = (gcnew System::Windows::Forms::Panel());
			this->comment_textBox = (gcnew System::Windows::Forms::TextBox());
			this->file_textBox = (gcnew System::Windows::Forms::TextBox());
			this->load_button = (gcnew System::Windows::Forms::Button());
			this->save_button = (gcnew System::Windows::Forms::Button());
			this->current_training_example_label = (gcnew System::Windows::Forms::Label());
			this->current_training_example_textBox = (gcnew System::Windows::Forms::TextBox());
			this->create_button = (gcnew System::Windows::Forms::Button());
			this->load_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->save_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->create_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->training_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->testing_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->prev_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->next_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->comment_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->grid_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->load_openFileDialog = (gcnew System::Windows::Forms::OpenFileDialog());
			this->save_saveFileDialog = (gcnew System::Windows::Forms::SaveFileDialog());
			this->file_label = (gcnew System::Windows::Forms::Label());
			this->create_solver_button = (gcnew System::Windows::Forms::Button());
			this->create_solver_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->input_panel = (gcnew System::Windows::Forms::Panel());
			this->input_radioButton = (gcnew System::Windows::Forms::RadioButton());
			this->target_radioButton = (gcnew System::Windows::Forms::RadioButton());
			this->input_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->target_toolTip = (gcnew System::Windows::Forms::ToolTip(this->components));
			this->current_testing_example_textBox = (gcnew System::Windows::Forms::TextBox());
			this->current_testing_example_label = (gcnew System::Windows::Forms::Label());
			this->status_label = (gcnew System::Windows::Forms::Label());
			this->status_progressBar = (gcnew System::Windows::Forms::ProgressBar());
			this->training_panel->SuspendLayout();
			this->input_panel->SuspendLayout();
			this->SuspendLayout();
			// 
			// prev_button
			// 
			this->prev_button->Location = System::Drawing::Point(160, 38);
			this->prev_button->Name = L"prev_button";
			this->prev_button->Size = System::Drawing::Size(46, 23);
			this->prev_button->TabIndex = 2;
			this->prev_button->Text = L"Prev";
			this->prev_button->UseVisualStyleBackColor = true;
			this->prev_button->Click += gcnew System::EventHandler(this, &Problem::prev_button_Click);
			// 
			// next_button
			// 
			this->next_button->Location = System::Drawing::Point(208, 38);
			this->next_button->Name = L"next_button";
			this->next_button->Size = System::Drawing::Size(46, 23);
			this->next_button->TabIndex = 3;
			this->next_button->Text = L"Next";
			this->next_button->UseVisualStyleBackColor = true;
			this->next_button->Click += gcnew System::EventHandler(this, &Problem::next_button_Click);
			// 
			// training_radioButton
			// 
			this->training_radioButton->AutoSize = true;
			this->training_radioButton->Location = System::Drawing::Point(15, 6);
			this->training_radioButton->Name = L"training_radioButton";
			this->training_radioButton->Size = System::Drawing::Size(63, 17);
			this->training_radioButton->TabIndex = 4;
			this->training_radioButton->TabStop = true;
			this->training_radioButton->Text = L"Training";
			this->training_radioButton->UseVisualStyleBackColor = true;
			this->training_radioButton->CheckedChanged += gcnew System::EventHandler(this, &Problem::training_radioButton_CheckedChanged);
			// 
			// testing_radioButton
			// 
			this->testing_radioButton->AutoSize = true;
			this->testing_radioButton->Location = System::Drawing::Point(15, 28);
			this->testing_radioButton->Name = L"testing_radioButton";
			this->testing_radioButton->Size = System::Drawing::Size(60, 17);
			this->testing_radioButton->TabIndex = 5;
			this->testing_radioButton->TabStop = true;
			this->testing_radioButton->Text = L"Testing";
			this->testing_radioButton->UseVisualStyleBackColor = true;
			this->testing_radioButton->CheckedChanged += gcnew System::EventHandler(this, &Problem::testing_radioButton_CheckedChanged);
			// 
			// training_panel
			// 
			this->training_panel->Controls->Add(this->training_radioButton);
			this->training_panel->Controls->Add(this->testing_radioButton);
			this->training_panel->Location = System::Drawing::Point(12, 68);
			this->training_panel->Name = L"training_panel";
			this->training_panel->Size = System::Drawing::Size(101, 56);
			this->training_panel->TabIndex = 8;
			// 
			// comment_textBox
			// 
			this->comment_textBox->Location = System::Drawing::Point(272, 12);
			this->comment_textBox->Name = L"comment_textBox";
			this->comment_textBox->Size = System::Drawing::Size(539, 20);
			this->comment_textBox->TabIndex = 9;
			this->comment_textBox->TextChanged += gcnew System::EventHandler(this, &Problem::comment_textBox_TextChanged);
			// 
			// file_textBox
			// 
			this->file_textBox->Location = System::Drawing::Point(44, 12);
			this->file_textBox->Name = L"file_textBox";
			this->file_textBox->Size = System::Drawing::Size(210, 20);
			this->file_textBox->TabIndex = 11;
			// 
			// load_button
			// 
			this->load_button->Location = System::Drawing::Point(15, 38);
			this->load_button->Name = L"load_button";
			this->load_button->Size = System::Drawing::Size(46, 23);
			this->load_button->TabIndex = 12;
			this->load_button->Text = L"Load";
			this->load_button->UseVisualStyleBackColor = true;
			this->load_button->Click += gcnew System::EventHandler(this, &Problem::load_button_Click);
			// 
			// save_button
			// 
			this->save_button->Location = System::Drawing::Point(63, 38);
			this->save_button->Name = L"save_button";
			this->save_button->Size = System::Drawing::Size(46, 23);
			this->save_button->TabIndex = 13;
			this->save_button->Text = L"Save";
			this->save_button->UseVisualStyleBackColor = true;
			this->save_button->Click += gcnew System::EventHandler(this, &Problem::save_button_Click);
			// 
			// current_training_example_label
			// 
			this->current_training_example_label->AutoSize = true;
			this->current_training_example_label->Location = System::Drawing::Point(15, 140);
			this->current_training_example_label->Name = L"current_training_example_label";
			this->current_training_example_label->Size = System::Drawing::Size(128, 13);
			this->current_training_example_label->TabIndex = 15;
			this->current_training_example_label->Text = L"Current Training Example:";
			// 
			// current_training_example_textBox
			// 
			this->current_training_example_textBox->Location = System::Drawing::Point(168, 136);
			this->current_training_example_textBox->Name = L"current_training_example_textBox";
			this->current_training_example_textBox->Size = System::Drawing::Size(86, 20);
			this->current_training_example_textBox->TabIndex = 21;
			// 
			// create_button
			// 
			this->create_button->Location = System::Drawing::Point(112, 38);
			this->create_button->Name = L"create_button";
			this->create_button->Size = System::Drawing::Size(46, 23);
			this->create_button->TabIndex = 26;
			this->create_button->Text = L"Create";
			this->create_button->UseVisualStyleBackColor = true;
			this->create_button->Click += gcnew System::EventHandler(this, &Problem::create_button_Click);
			// 
			// load_toolTip
			// 
			this->load_toolTip->ToolTipTitle = L"Load";
			// 
			// save_toolTip
			// 
			this->save_toolTip->ToolTipTitle = L"Save";
			// 
			// create_toolTip
			// 
			this->create_toolTip->ToolTipTitle = L"New";
			// 
			// training_toolTip
			// 
			this->training_toolTip->ToolTipTitle = L"Training";
			// 
			// testing_toolTip
			// 
			this->testing_toolTip->ToolTipTitle = L"Testing";
			// 
			// prev_toolTip
			// 
			this->prev_toolTip->ToolTipTitle = L"Prev";
			// 
			// next_toolTip
			// 
			this->next_toolTip->ToolTipTitle = L"Next";
			// 
			// comment_toolTip
			// 
			this->comment_toolTip->ToolTipTitle = L"Comment";
			// 
			// grid_toolTip
			// 
			this->grid_toolTip->ToolTipTitle = L"Grid";
			// 
			// load_openFileDialog
			// 
			this->load_openFileDialog->Title = L"Load";
			// 
			// save_saveFileDialog
			// 
			this->save_saveFileDialog->Title = L"Save";
			// 
			// file_label
			// 
			this->file_label->AutoSize = true;
			this->file_label->Location = System::Drawing::Point(15, 15);
			this->file_label->Name = L"file_label";
			this->file_label->Size = System::Drawing::Size(26, 13);
			this->file_label->TabIndex = 27;
			this->file_label->Text = L"File:";
			// 
			// create_solver_button
			// 
			this->create_solver_button->Location = System::Drawing::Point(18, 200);
			this->create_solver_button->Name = L"create_solver_button";
			this->create_solver_button->Size = System::Drawing::Size(239, 23);
			this->create_solver_button->TabIndex = 28;
			this->create_solver_button->Text = L"Create Solver";
			this->create_solver_button->UseVisualStyleBackColor = true;
			this->create_solver_button->Click += gcnew System::EventHandler(this, &Problem::create_solver_button_Click);
			// 
			// create_solver_toolTip
			// 
			this->create_solver_toolTip->ToolTipTitle = L"Create Solver";
			// 
			// input_panel
			// 
			this->input_panel->Controls->Add(this->input_radioButton);
			this->input_panel->Controls->Add(this->target_radioButton);
			this->input_panel->Location = System::Drawing::Point(153, 68);
			this->input_panel->Name = L"input_panel";
			this->input_panel->Size = System::Drawing::Size(101, 56);
			this->input_panel->TabIndex = 9;
			// 
			// input_radioButton
			// 
			this->input_radioButton->AutoSize = true;
			this->input_radioButton->Location = System::Drawing::Point(15, 6);
			this->input_radioButton->Name = L"input_radioButton";
			this->input_radioButton->Size = System::Drawing::Size(49, 17);
			this->input_radioButton->TabIndex = 4;
			this->input_radioButton->TabStop = true;
			this->input_radioButton->Text = L"Input";
			this->input_radioButton->UseVisualStyleBackColor = true;
			this->input_radioButton->CheckedChanged += gcnew System::EventHandler(this, &Problem::input_radioButton_CheckedChanged);
			// 
			// target_radioButton
			// 
			this->target_radioButton->AutoSize = true;
			this->target_radioButton->Location = System::Drawing::Point(15, 28);
			this->target_radioButton->Name = L"target_radioButton";
			this->target_radioButton->Size = System::Drawing::Size(56, 17);
			this->target_radioButton->TabIndex = 5;
			this->target_radioButton->TabStop = true;
			this->target_radioButton->Text = L"Target";
			this->target_radioButton->UseVisualStyleBackColor = true;
			this->target_radioButton->CheckedChanged += gcnew System::EventHandler(this, &Problem::target_radioButton_CheckedChanged);
			// 
			// input_toolTip
			// 
			this->input_toolTip->ToolTipTitle = L"Input";
			// 
			// target_toolTip
			// 
			this->target_toolTip->ToolTipTitle = L"Target";
			// 
			// current_testing_example_textBox
			// 
			this->current_testing_example_textBox->Location = System::Drawing::Point(168, 167);
			this->current_testing_example_textBox->Name = L"current_testing_example_textBox";
			this->current_testing_example_textBox->Size = System::Drawing::Size(86, 20);
			this->current_testing_example_textBox->TabIndex = 32;
			// 
			// current_testing_example_label
			// 
			this->current_testing_example_label->AutoSize = true;
			this->current_testing_example_label->Location = System::Drawing::Point(15, 171);
			this->current_testing_example_label->Name = L"current_testing_example_label";
			this->current_testing_example_label->Size = System::Drawing::Size(125, 13);
			this->current_testing_example_label->TabIndex = 31;
			this->current_testing_example_label->Text = L"Current Testing Example:";
			// 
			// status_label
			// 
			this->status_label->AutoSize = true;
			this->status_label->Location = System::Drawing::Point(19, 235);
			this->status_label->Name = L"status_label";
			this->status_label->Size = System::Drawing::Size(0, 13);
			this->status_label->TabIndex = 34;
			// 
			// status_progressBar
			// 
			this->status_progressBar->Location = System::Drawing::Point(15, 261);
			this->status_progressBar->Name = L"status_progressBar";
			this->status_progressBar->Size = System::Drawing::Size(239, 23);
			this->status_progressBar->Style = System::Windows::Forms::ProgressBarStyle::Continuous;
			this->status_progressBar->TabIndex = 33;
			// 
			// Problem
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(825, 296);
			this->Controls->Add(this->status_label);
			this->Controls->Add(this->status_progressBar);
			this->Controls->Add(this->current_testing_example_textBox);
			this->Controls->Add(this->current_testing_example_label);
			this->Controls->Add(this->input_panel);
			this->Controls->Add(this->create_solver_button);
			this->Controls->Add(this->file_label);
			this->Controls->Add(this->create_button);
			this->Controls->Add(this->current_training_example_textBox);
			this->Controls->Add(this->current_training_example_label);
			this->Controls->Add(this->file_textBox);
			this->Controls->Add(this->comment_textBox);
			this->Controls->Add(this->next_button);
			this->Controls->Add(this->prev_button);
			this->Controls->Add(this->training_panel);
			this->Controls->Add(this->load_button);
			this->Controls->Add(this->save_button);
			this->Name = L"Problem";
			this->Text = L"Problem";
			this->training_panel->ResumeLayout(false);
			this->training_panel->PerformLayout();
			this->input_panel->ResumeLayout(false);
			this->input_panel->PerformLayout();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
	};
}
